<?php
include("geoipcity.inc");
include("geoipregionvars.php");
$gi = geoip_open("./GeoIP/GeoLiteCity.dat", GEOIP_STANDARD);
$record = geoip_record_by_addr($gi, $_SERVER['REMOTE_ADDR']);
$region_name = $GEOIP_REGION_NAME[$record->country_code][$record->region];

$laptopId = $_GET['id']; 
$remoteIp = $_SERVER['REMOTE_ADDR'];
$fh = fopen("/tmp/dooplet_server.log",'a') or die("cant open dooplet log file");

$str = $laptopId.";".$remoteIp.";".(gmdate(DATE_RFC822));
$str = $str.";".$record->country_code3.";".$record->country_name;
$str = $str.";".$record->region.";".$region_name.";".$record->city;

fwrite($fh,$str);
fclose($fh);
echo $str;
geoip_close($gi);
?>
